package com.codeduck.guava.strings;

import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;

import java.util.Arrays;
import java.util.Map;

/**
 * @author: <a href="mailto:codeduck@163.com">Codeduck</a>
 * @createDate: 2022-05-19
 */
public class Demo01 {
    public static void main(String[] args) {
        Joiner joiner = Joiner.on("; ").useForNull("##");
        System.out.println(joiner.join("Harry", null, "Ron", "Hermione"));
        System.out.println(Arrays.toString(",a,,b,".split(",")));

        Iterable<String> split = Splitter.on(',')
                .trimResults()
                .omitEmptyStrings()
                .split("foo,bar,,   qux");
        split.forEach(System.out::println);
        Map<String, String> split1 = Splitter.on(",")
                .trimResults()
                .omitEmptyStrings()
                .withKeyValueSeparator(":")
                .split("a:1,b:2,c:3");
        System.out.println("b".compareTo("b"));

    }

}
